package com.dlwx.firefighting.adapter;

import android.content.Context;

import com.dlwx.firefighting.R;
import com.dlwx.firefighting.bean.UserCollectBean;
import com.dlwx.firefighting.utils.glide.GlideImageLoader;

/**
 * Created by Administrator on 2017/7/6.
 */

public class UserCollectAdapter extends ListBaseAdapter<UserCollectBean> {
    private GlideImageLoader imageLoader;
    private OnItemDeleteListener onItemDeleteListener;
    private Context context;

    public UserCollectAdapter(Context context) {
        super(context);
        imageLoader = new GlideImageLoader(context);
        this.context=context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.user_collect_item;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, final int position) {
        UserCollectBean bean = mDataList.get(position);
//        ImageView imageView = holder.getView(R.id.user_collect_img);
//        ImageView typeImg = holder.getView(R.id.type_img);
//        TextView titleTv = holder.getView(R.id.user_collect_title);
//        TextView typeTv = holder.getView(R.id.user_collect_type);
//        AutoRelativeLayout relativeLayout = holder.getView(R.id.rel_delete_img);
//        Glide.with(context).load(bean.getThumb()).error(R.mipmap.error_small1).into(imageView);
//        titleTv.setText(bean.getTitle());
//        typeTv.setText(bean.getDescrible());
//        int type=bean.getType();
////        "type": 1//  1、商品 2、视频 3、音频
////        1、商品 2、音视频
//        switch (type){
//            case 1:
//                typeImg.setVisibility(View.GONE);
//                break;
//            case 2:
//                typeImg.setVisibility(View.VISIBLE);
//                typeImg.setBackgroundResource(R.mipmap.video_play_normal);
//                break;
//            case 3:
//                typeImg.setVisibility(View.VISIBLE);
////                typeImg.setBackgroundResource(R.mipmap.music);
//                break;
//        }
//
//        if (onItemDeleteListener != null) {
//            relativeLayout.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    onItemDeleteListener.OnDelete(position);
//                }
//            });
//        }
    }

    public interface OnItemDeleteListener {
        void OnDelete(int position);
    }

    public void setOnItemDeleteListener(OnItemDeleteListener onItemDeleteListener) {
        this.onItemDeleteListener = onItemDeleteListener;
    }

}
